package com.wms.service.impl;


import com.wms.entity.BaseSupplier;
import com.wms.entity.BaseSupplierDTO;
import com.wms.entity.DialogFormDTO;
import com.wms.mapper.BaseSupplierMapper;
import com.wms.service.BaseSupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.Date;
import java.util.List;

/**
 * @Author Ayases
 * @Date 2025/4/27 20:35
 * @Desc
 */
@Service
public class BaseSupplierServiceImpl implements BaseSupplierService {

    BaseSupplierDTO baseSupplierDTO=new BaseSupplierDTO();

    @Autowired
    private BaseSupplierMapper mapper;

    @Override
    public List<BaseSupplier> findAll(BaseSupplierDTO baseSupplierDTO) {
        return mapper.findAll(baseSupplierDTO);
    }

    @Override
    public void deleteOne(Integer id) {
        mapper.deleteOne(id);
    }

    @Override
    public void deleteBatch(Integer[] selectedIds) {
        for (Integer id : selectedIds) {
            mapper.deleteOne(id);
        }
    }

    @Override
    public void forbid(Integer supplierId) {
        mapper.forbid(supplierId);
    }

    @Override
    public void enable(Integer supplierId) {
        mapper.enable(supplierId);
    }

    @Override
    public void update(DialogFormDTO dialogFormDTO) {
        dialogFormDTO.setUpdateTime(new Date());
        mapper.update(dialogFormDTO);
    }

    @Override
    public List<String> findName() {
        return mapper.findName();
    }

    @Override
    public void save(DialogFormDTO dialogFormDTO) {
        dialogFormDTO.setCreateTime(new Date());
        mapper.save(dialogFormDTO);
    }

}
